Home

Operator Usage

Name

op-if

Description

op-if(condition, operator1, operator2) input-seq
op-if condition evaluates to |yes> or |true> then apply operator1 to input-seq
else apply operator2 to input-seq
NB: the python version of if() is much uglier and clunkier.
It is now implemented as value-if()


Examples

-- just define a couple of abstract operators:
op1 (*) #=> |op1:> __ smerge[", "] |__self>
op2 (*) #=> |op2:> __ smerge[", "] |__self>

-- then apply it:
op-if(|yes>, |op: op1>, |op: op2>) ssplit |abc>
    |op1: a, b, c>

op-if(|no>, |op: op1>, |op: op2>) ssplit |abc>
    |op2: a, b, c>


See also

Operator type

context function 3